From: Keir Fraser Date: Wed, 17 Jun 2009 06:38:42 +0000 (+0100) Subject: xend: pass-through: Use common parsing code in parse_pci_configuration() X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~13745 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=a96eef5ee39efe3e385bd4ad044e61a338254c12;p=xen.git xend: pass-through: Use common parsing code in parse_pci_configuration() Signed-off-by: Simon Horman --- diff --git a/tools/python/xen/xm/main.py b/tools/python/xen/xm/main.py index 515d937e61..1f519b3ed0 100644 --- a/tools/python/xen/xm/main.py +++ b/tools/python/xen/xm/main.py @@ -2489,36 +2489,16 @@ def parse_pci_configuration(args, state, opts = ''): dom = args[0] pci_dev_str = args[1] if len(args) == 3: - vslot = args[2] - else: - vslot = AUTO_PHP_SLOT_STR - pci=['pci'] - pci_match = re.match(r"((?P[0-9a-fA-F]{1,4})[:,])?" + \ - r"(?P[0-9a-fA-F]{1,2})[:,]" + \ - r"(?P[0-9a-fA-F]{1,2})[.,]" + \ - r"(?P[0-7])$", pci_dev_str) - if pci_match == None: - raise OptionError("Invalid argument: %s %s" % (pci_dev_str, vslot)) - pci_dev_info = pci_match.groupdict('0') + pci_dev_str += '@' + args[2] + if len(opts) > 0: + pci_dev_str += ',' + serialise_pci_opts(opts) try: - pci_bdf =['dev', ['domain', '0x'+ pci_dev_info['domain']], \ - ['bus', '0x'+ pci_dev_info['bus']], - ['slot', '0x'+ pci_dev_info['slot']], - ['func', '0x'+ pci_dev_info['func']], - ['vslot', '0x%x' % int(vslot, 16)]] - except: - raise OptionError("Invalid argument: %s %s" % (pci_dev_str, vslot)) - - try: - check_pci_opts(opts) + pci_dev = parse_pci_name_extended(pci_dev_str) except PciDeviceParseError, ex: raise OptionError(str(ex)) - pci.append(sxp.merge(pci_bdf, pci_opts_list_to_sxp(opts))) - pci.append(['state', state]) - - return (dom, pci) + return (dom, pci_convert_dict_to_sxp(pci_dev, state)) def xm_pci_attach(args): config_pci_opts = []